<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

	<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/global.css" media="all" />
</head>
<body>
    <div>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div>
                <header style="height: 100%">
                    <div align="left">
	                    <table style="width: 100%">
	                   		<tr>
	                   			<td>
		                   			<form class="form-inline" onsubmit="return false">
										<div class="form-group">
											单位：
											<input id="branch" type="text" class="form-control" placeholder="单位">
											问题：
											<input id="overseeQuestion" type="text" class="form-control" placeholder="问题">
											审核状态：
											<select class="form-control input-sm" id="checkStatus">
											</select>
											整改进度：
											<select class="form-control input-sm" id="questionStatus">
											</select>
											督察形式：
											<select class="form-control input-sm" id="overseeForm">
											</select>
											<button id="searchBt" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe615;</i>搜索</button>
										</div>
									</form>
	                   			</td>
	                   			<td align="right">
	                   				<button class="layui-btn layui-btn-sm" onclick="location.href='addQuestionRecord.html'">
                                      <i class="layui-icon">&#xe608;</i> 添加
                                    </button>
	                   			</td>
	                   		</tr> 
	                    </table>
					</div>
                </header>
                
                <div>
                    <div class="widget-body no-padding">
                        <table id="dt-table" class="table table-striped table-bordered table-hover" style="width:100%">
                            <thead>
                                <tr>
                                </tr>                       
                                <tr>
									<th>id</th>
									<th>问题</th>
									<th>单位</th>
									<th>审核状态</th>
									<th>问题整改进度</th>
									<th>督察形式</th>
									<th>操作记录</th>
									<th>操作人</th>
									<th>创建时间</th>
									<th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<script type="text/javascript" src="../../js/libs/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/plugin/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../../js/plugin/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/my/permission.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/dict.js"></script>
<script type="text/javascript">

	layui.use('layer', function(){
		var layer = layui.layer;
	});
	var questionStatus = showDictSelect("questionStatus", "questionStatus", true);
	var overseeForm = showDictSelect("overseeForm", "overseeForm", true);
	var checkStatus = showDictSelect("checkStatus", "checkStatus", true);
var pers = checkPermission();

var example;
function init(){
	example = 
    	$('#dt-table').DataTable({
        	"searching": false,
        	"processing": false,
        	"serverSide" : true,
			"ordering": false,
        	"language": {
                "url": "/js/plugin/datatables/Chinese.lang"
            },
        	"ajax": {
        		"url" : "/questionRecords",
        		"type":"get",
        		"data":function(d){
					d.branch = $('#branch').val();
					d.overseeForm = $("#overseeForm option:selected").text();
					d.checkStatus = $("#checkStatus option:selected").text();
					d.questionStatus = $("#questionStatus option:selected").text();
					d.overseeQuestion = $('#overseeQuestion').val();
    			}
        	},
			"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'table-bottom col-sm-10 col-xs-12 hidden-xs'i><'table-bottom col-xs-12 col-sm-10' p v>>",
            "columns": [
				{"data" : "id", "defaultContent" : ""},
				{"data" : "overseeQuestion", "defaultContent" : ""},
				{"data" : "branch", "defaultContent" : ""},
				{"data" : "checkStatus", "defaultContent" : ""},
				{"data" : "questionStatus", "defaultContent" : ""},
				{"data" : "overseeForm", "defaultContent" : ""},
				{"data" : "detail", "defaultContent" : ""},
				{"data" : "updateUser", "defaultContent" : ""},
				{"data" : "createTime", "defaultContent" : ""},
				{
								"data": "", 
								"defaultContent": "",
								"orderable":false,
						        "render": function (data, type, row) {
                		           var id = row['id'];
                		           var href = "updateQuestionRecord.html?id=" + id;
                                   var edit = buttonEdit(href, "", pers);
                		           var del = buttonDel(id, "", pers);
                                   return edit + del;
                  	            }		
							},
                
            ],
           "order": [[ 0, "asc" ]]
        } );
}

layui.use('layer', function(){
    var layer = layui.layer;
});

function del(id){
	layer.confirm('确定要删除吗？', {
        btn : [ '确定', '取消' ]
    }, function() {
    	$.ajax({
            type : 'delete',
            url : '/questionRecords/'+id,
            success : function(data) {
                example.ajax.reload();
                layer.msg("删除成功");
            }
        });
        
        layer.close(1);
    });
}

$("#searchBt").click(function(){
	example.ajax.reload();
});

init();
</script>
